package com.dw.dwdzcommerce.view.operate;

import com.dw.dwdzcommerce.R;

import android.annotation.SuppressLint;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

public class OperateTabLayout {

	@SuppressLint("InflateParams")
	public void initModule(OperateActivity context) {
		ViewGroup root = (ViewGroup) context.findViewById(R.id.activity_operate_bottom_tab_linear);
		Button mainBtn = (Button) root.findViewById(R.id.activity_operate_bottom_tab_main_btn);
		Button mapBtn = (Button) root.findViewById(R.id.activity_operate_bottom_tab_map_btn);
		Button mineBtn = (Button) root.findViewById(R.id.activity_operate_bottom_tab_mine_btn);
		mainBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (mOnTabClickListener != null) {
					mOnTabClickListener.onMainClick(v);
				}
			}
		});

		mapBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (mOnTabClickListener != null) {
					mOnTabClickListener.onMapClick(v);
				}
			}
		});

		mineBtn.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (mOnTabClickListener != null) {
					mOnTabClickListener.onMineClick(v);
				}
			}
		});

	}

	public void setmOnTabClickListener(OnTabClickListener mOnTabClickListener) {
		this.mOnTabClickListener = mOnTabClickListener;
	}

	private OnTabClickListener mOnTabClickListener;

	public interface OnTabClickListener {
		void onMainClick(View mainBtn);

		void onMapClick(View mapBtn);

		void onMineClick(View mineBtn);
	}
}
